package com.nuc.zyt.day05.bio;

import java.net.ServerSocket;
import java.net.Socket;

/**
 * @ClassName Server
 * @Description TODO
 * @Author 耀酱
 * @Date 2023/5/31 8:23
 * @Version 1.0
 */

public class Server {
    public static void main(String[] args) {

        try {
            // 注册服务器socket
            ServerSocket serverSocket = new ServerSocket(9999);
            HandleSocketServerPool hss = new HandleSocketServerPool(6,5);
            while (true){
                Socket accept = serverSocket.accept(); // 监听端口 阻塞

                Runnable runnable = new ServerRunnable(accept);

                hss.execute(runnable); // 提交任务到线程池




            }

        }catch (Exception e){
            e.printStackTrace();
        }


    }
}
